<?php
//我的劵
InitGP(array("action","step","money","paytype","page")); //初始化变量全局返回
include_once CFG_CACHEPATH.'/sys_pay.cache.php';//支付配置文件
$payment_listvalue = array();
$payment_list = array();
foreach($payment_select as $k => $val)
{
	$temp_arr['name'] = $cfg_pay_info['name'][$k];
	$temp_arr['logo'] = 'images/pay/'.$cfg_pay_info['logo'][$k];
	$temp_arr['des']	= $cfg_pay_info['des'][$k];
	$temp_arr['value'] = $val;
	$temp_arr['exp'] = sprintf("%01.2f", $price*$payment_exp[$k]);
	$payment_listvalue[$val] = $temp_arr;
	$payment_list[] = $temp_arr;
}
?>
<style>
body{font-size:14px;line-height:30px}
input.formbutton {
	padding:4px 1em;
*padding:5px 1.5em 0;
	border:2px solid;
	border-color:#82D0D4 #4D989B #54A3A7 #92D6D9;
	background:#63C5C8;
	color:#fff;
	letter-spacing:.1em;
	cursor:pointer;
*width:auto;
	_width:0;
*overflow:visible;
}
</style>
<?php
if(empty($step)){
?>

<H3><SPAN id=order-pay-dialog-close>会员充值</SPAN></H3>
<form action="<?php echo $theurl?>&step=pay" method="POST">
充值金额：<input type=text name="money" value="<?php echo !empty($money)?$money:100?>"/>

<div class="order-check-form " id="payment_div">
  <p class="choose-pay-type">请选择支付方式：</p>
  <table width="100%" border="0" cellspacing="2" cellpadding="2">
  <?php foreach($payment_list as $i=>$m){?>
  <tr>
    <td><input type="radio" name="paytype" value="<?php echo $m['value']?>" <?php if($i==0)echo "checked='checked'"?>/></td>
    <td><img src="<?php echo $m['logo']?>"/></td>
    <td><?php echo $m['name']?></td>
  </tr>
  <?php }?>
</table>
  <div class="clear"></div>
</div>
<input type="submit"  class=formbutton  name="commit" value="提交充值"/>

</form>
<?php
}elseif($step=="pay"){
$money = sprintf("%01.2f", $money);
$OrdersId=$_USERS['uid']."_".$_USERS['uname'];//订单号
$priceCount=GetNum($money);//价格
$value["gtitle"]="会员充值";
$_ACCOUNTCHARGE=true;//标识是会员充值

//初始化对象
include(INC_PATH."/accountcharge.class.php");
$ac=new AccountChargeClass();
$addarray=array(
	"money"=>GetNum($money),
	"uid"=>$_USERS['uid'],
	"uname"=>$_USERS['uname'],
	"payname"=>$payment_listvalue[$paytype]['name']
);
$info=$ac->add($addarray);
if(is_numeric($info)){
	$OrdersId=$info;
}else{
	showmessage($info,"-1",false);
}
//处理付款操作
require_once ROOT_PATH.'/paycenter/'.$paytype.'/config_pay_'.$paytype.'.php';//引用支付处理文件

echo '<html>
<head>
	<title>转到支付页面</title>
</head>
<body onLoad="document.gotopay.submit();">
	<form name="gotopay" action="'.$strRequestUrl.'" method="post" target="_blank">
	'.$hiddeninput.'
	</form>
</body>
</html>';
?>

<DIV class=order-pay-dialog-c>
<H3><SPAN id=order-pay-dialog-close>请您在新打开的页面上
完成付款</SPAN></H3>
<P class=notice>如果付款窗口被阻止请选择允许本站弹出窗口!<BR>付款完成前请不要关闭此窗口。<BR>完成付款后请根据您的情况点击下面的按钮：</P>
</DIV>
<input onclick="document.gotopay.submit();" class=formbutton type="submit" name="commit" value="充值失败重新充值"/>
<input onclick="window.parent.closef();" class=formbutton type="button" name="commit" value="已经充值完成"/>

<P class=retry><A id=order-pay-dialog-back class=back href="<?php echo $theurl?>&moeny=<?php echo $money?>)">>>返回选择其他支付方式</P>

<?php
}
?>
